/*
 * MenuDelegate.h  0.4.0 / Dec 05, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef MENUDELEGATE_H
#define MENUDELEGATE_H

#include "Cute4jSwing.h"

#include "ContainerDelegate.h"

// MenuDelegate Class. ---------------------------------------------------------

/*!
 * \brief Menu Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT MenuDelegate : public ContainerDelegate
{
  Q_OBJECT
protected:
  MenuDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void setText(JNIEnv *env, jstring text);
  void insertChild(JNIEnv *env, jlong childDelegate, jint index);
  void removeChild(JNIEnv *env, jlong childDelegate);
  void show(JNIEnv *env, jint x, jint y);
public: // native calls
  static jlong newInstance(JNIEnv *env, jobject obj);
public:
  inline QMenu *qMenu() const;
public:
  virtual QAction *qAction();
};

// MenuDelegate :: Public Inline Member Function. ------------------------------

/*!
 * \brief Returns QMenu adaptee.
 *
 * \return QMenu adaptee
 */
inline QMenu *MenuDelegate::qMenu() const
{
  return static_cast<QMenu *>(qObject());
}

// Macro Definitions. ----------------------------------------------------------

#define MENU_CAST(delegate) (reinterpret_cast<MenuDelegate *>(delegate))
#define MENU_DELEGATE MENU_CAST(delegate)

#endif // MENUDELEGATE_H
